const router = require('koa-router')() // 一边导入一边实例化
const result = require('../../config/result.js')
const { regcheck, checking } = require('../../config/checking.js')
const bodyParser = require('koa-bodyparser')
// 操作数据库的接口
const { getToken, Addurl } = require('../../config/databaseapi.js')
// 注册接口
router.post('/adduserlist', async (ctx) => {
	console.log("调用添加党员接口")
	console.log(ctx.request.body);
	let { form } = ctx.request.body;
	let query = `db.collection("member_info").add({data:${JSON.stringify(form)}})`;
	let res = await new getToken().posteve(Addurl, query)
	// console.log('添加用户',res)
	if (res.errcode === 0) {
		ctx.body = { msg: "添加成功", status: 1 }
	} else {
		ctx.body = { msg: "添加失败", status: 0 }
	}
})

module.exports = router.routes()